Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate test_agentd documentation to qa-docs #2006

Merged
merged 3 commits into from
Nov 2, 2021
Merged

Conversation

mdengra
Copy link
Contributor

@mdengra mdengra commented Oct 8, 2021

Related issue
#1796

Description

As part of epic #1796, this PR adds the missing documentation and migrates the current documentation to the new format used by qa-docs.
The schema used is the one defined in issue #1694

Generated documentation

test_agent_auth_enrollment.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'agent-auth' program is the client application used along with the 'wazuh-authd' daemon to automatically add agents to a Wazuh manager. The objective is to check if the parameters sent by the 'agent-auth' program to the 'wazuh-authd' daemon are consistent with its responses.",
    "tier": 0,
    "modules": [
        "agentd"
    ],
    "components": [
        "agent"
    ],
    "daemons": [
        "wazuh-agentd",
        "wazuh-authd",
        "wazuh-remoted"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2016",
        "Windows server 2012",
        "Windows server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/registering/index.html"
    ],
    "tags": [
        "enrollment"
    ],
    "name": "test_agent_auth_enrollment.py",
    "id": 1,
    "group_id": 0,
    "tests": [
        {
            "description": "Check different situations that can occur during agent enrollment. The tests are based on using certain parameters to enroll the agent with the manager. The enrollment is then started, and the response received is compared with the expected one.",
            "wazuh_min_version": 4.2,
            "parameters": [
                {
                    "configure_authd_server": {
                        "type": "fixture",
                        "brief": "Initializes a simulated 'wazuh-authd' connection."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "test_case": {
                        "type": "list",
                        "brief": "List of tests to be performed."
                    }
                }
            ],
            "assertions": [
                "Verify that expected enrollment request message occurs."
            ],
            "input_description": "An external YAML file (wazuh_conf.yaml) includes configuration settings for the agent. Different test cases are contained in an external YAML file (wazuh_enrollment_tests.yaml) which includes enrollment parameters.",
            "expected_output": [
                "Multiple messages corresponding to each test case, located in the external input data file."
            ],
            "tags": [
                "simulator",
                "ssl",
                "keys"
            ],
            "name": "test_agent_auth_enrollment",
            "inputs": [
                "-No agent name in auto enrollment configuration",
                "-Check a valid agent_address configurations",
                "-Check a valid agent_address configurations CIDR",
                "-Check a invalid CIDR agent_address in auto enrollment configuration",
                "-Check a invalid agent_address in auto enrollment configuration",
                "-Check a valid manager_address configurations",
                "-Agent groups in auto enrollment configuration",
                "-Agent multi groups in auto enrollment configuration",
                "-Check a invalid enabled in auto enrollment configuration",
                "-Check a valid agent_name configurations",
                "-Check a valid agent_name configurations max length",
                "-Check a invalid agent_name configurations",
                "-Check a invalid agent_name configurations too short",
                "-Check a invalid agent_name configurations too long",
                "-Try auto negotiation option using TLSv1_1",
                "-Try auto negotiation option using TLSv1_2",
                "-Try TLSv1_1 without auto_negotiation",
                "-Try connecting with Compatible ciphers",
                "-Try connecting with Incompatible ciphers",
                "-Try validating server with a valid certificate",
                "-Try validating server with an invalid certificate",
                "-Try validating agent with an invalid certificate0",
                "-Try validating agent with an invalid certificate1",
                "-Check that source IP is sent by agent",
                "-Use source IP option while trying to set an IP",
                "-Check that configured password is sent on string",
                "-Check that password file is open and read successfully0",
                "-Check that password file is open and read successfully1",
                "-Check a valid port configurations",
                "-Check a invalid port configurations 65536",
                "-Check a invalid port configurations 0",
                "-Check a invalid port configurations -1515",
                "-Check a valid delay_after_enrollment configurations 10",
                "-Check a invalid delay_after_enrollment configurations -30",
                "-Check enrollment with all parameters configurations"
            ]
        }
    ]
}

test_agent_auth_enrollment.yaml

brief: The 'agent-auth' program is the client application used along with the 'wazuh-authd'
  daemon to automatically add agents to a Wazuh manager. The objective is to check
  if the parameters sent by the 'agent-auth' program to the 'wazuh-authd' daemon are
  consistent with its responses.
components:
- agent
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-agentd
- wazuh-authd
- wazuh-remoted
group_id: 0
id: 1
modules:
- agentd
name: test_agent_auth_enrollment.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2016
- Windows server 2012
- Windows server 2003
- Windows XP
references:
- https://documentation.wazuh.com/current/user-manual/registering/index.html
tags:
- enrollment
tests:
- assertions:
  - Verify that expected enrollment request message occurs.
  description: Check different situations that can occur during agent enrollment.
    The tests are based on using certain parameters to enroll the agent with the manager.
    The enrollment is then started, and the response received is compared with the
    expected one.
  expected_output:
  - Multiple messages corresponding to each test case, located in the external input
    data file.
  input_description: An external YAML file (wazuh_conf.yaml) includes configuration
    settings for the agent. Different test cases are contained in an external YAML
    file (wazuh_enrollment_tests.yaml) which includes enrollment parameters.
  inputs:
  - -No agent name in auto enrollment configuration
  - -Check a valid agent_address configurations
  - -Check a valid agent_address configurations CIDR
  - -Check a invalid CIDR agent_address in auto enrollment configuration
  - -Check a invalid agent_address in auto enrollment configuration
  - -Check a valid manager_address configurations
  - -Agent groups in auto enrollment configuration
  - -Agent multi groups in auto enrollment configuration
  - -Check a invalid enabled in auto enrollment configuration
  - -Check a valid agent_name configurations
  - -Check a valid agent_name configurations max length
  - -Check a invalid agent_name configurations
  - -Check a invalid agent_name configurations too short
  - -Check a invalid agent_name configurations too long
  - -Try auto negotiation option using TLSv1_1
  - -Try auto negotiation option using TLSv1_2
  - -Try TLSv1_1 without auto_negotiation
  - -Try connecting with Compatible ciphers
  - -Try connecting with Incompatible ciphers
  - -Try validating server with a valid certificate
  - -Try validating server with an invalid certificate
  - -Try validating agent with an invalid certificate0
  - -Try validating agent with an invalid certificate1
  - -Check that source IP is sent by agent
  - -Use source IP option while trying to set an IP
  - -Check that configured password is sent on string
  - -Check that password file is open and read successfully0
  - -Check that password file is open and read successfully1
  - -Check a valid port configurations
  - -Check a invalid port configurations 65536
  - -Check a invalid port configurations 0
  - -Check a invalid port configurations -1515
  - -Check a valid delay_after_enrollment configurations 10
  - -Check a invalid delay_after_enrollment configurations -30
  - -Check enrollment with all parameters configurations
  name: test_agent_auth_enrollment
  parameters:
  - configure_authd_server:
      brief: Initializes a simulated 'wazuh-authd' connection.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - test_case:
      brief: List of tests to be performed.
      type: list
  tags:
  - simulator
  - ssl
  - keys
  wazuh_min_version: 4.2
tier: 0
type: integration

 

test_agentd_enrollment_params.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-agentd' program is the client-side daemon that communicates with the server. The objective is to check if the enrollment of the agent using certain settings in the configuration file produces the expected responses from the server.",
    "tier": 0,
    "modules": [
        "agentd"
    ],
    "components": [
        "agent"
    ],
    "daemons": [
        "wazuh-agentd",
        "wazuh-authd",
        "wazuh-remoted"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2016",
        "Windows server 2012",
        "Windows server 2003"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/registering/index.html"
    ],
    "tags": [
        "enrollment"
    ],
    "name": "test_agentd_enrollment_params.py",
    "id": 2,
    "group_id": 0,
    "tests": [
        {
            "description": "Check different situations that can occur on the 'wazuh-agentd' daemon during agent enrollment. The tests are based on using specific configurations for the agent, initiate the agent enrollment with the manager, and finally, verify that the response received matches the expected one.",
            "wazuh_min_version": 4.2,
            "parameters": [
                {
                    "configure_authd_server": {
                        "type": "fixture",
                        "brief": "Initializes a simulated 'wazuh-authd' connection."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "test_case": {
                        "type": "list",
                        "brief": "List of tests to be performed."
                    }
                }
            ],
            "assertions": [
                "Verify that expected enrollment request message occurs."
            ],
            "input_description": "An external YAML file (wazuh_conf.yaml) includes configuration settings for the agent. Different test cases are contained in an external YAML file (wazuh_enrollment_tests.yaml) which includes enrollment parameters.",
            "expected_output": [
                "Multiple messages corresponding to each test case, located in the external input data file."
            ],
            "tags": [
                "simulator",
                "ssl",
                "keys"
            ],
            "name": "test_agent_agentd_enrollment",
            "inputs": [
                "-No agent name in auto enrollment configuration",
                "-Check a valid agent_address configurations",
                "-Check a valid agent_address configurations CIDR",
                "-Check a invalid CIDR agent_address in auto enrollment configuration",
                "-Check a invalid agent_address in auto enrollment configuration",
                "-Check a valid manager_address configurations",
                "-Agent groups in auto enrollment configuration",
                "-Agent multi groups in auto enrollment configuration",
                "-Check a invalid enabled in auto enrollment configuration",
                "-Check a valid agent_name configurations",
                "-Check a valid agent_name configurations max length",
                "-Check a invalid agent_name configurations",
                "-Check a invalid agent_name configurations too short",
                "-Check a invalid agent_name configurations too long",
                "-Try auto negotiation option using TLSv1_1",
                "-Try auto negotiation option using TLSv1_2",
                "-Try TLSv1_1 without auto_negotiation",
                "-Try connecting with Compatible ciphers",
                "-Try connecting with Incompatible ciphers",
                "-Try validating server with a valid certificate",
                "-Try validating server with an invalid certificate",
                "-Try validating agent with an invalid certificate0",
                "-Try validating agent with an invalid certificate1",
                "-Check that source IP is sent by agent",
                "-Use source IP option while trying to set an IP",
                "-Check that configured password is sent on string",
                "-Check that password file is open and read successfully0",
                "-Check that password file is open and read successfully1",
                "-Check a valid port configurations",
                "-Check a invalid port configurations 65536",
                "-Check a invalid port configurations 0",
                "-Check a invalid port configurations -1515",
                "-Check a valid delay_after_enrollment configurations 10",
                "-Check a invalid delay_after_enrollment configurations -30",
                "-Check enrollment with all parameters configurations"
            ]
        }
    ]
}

test_agentd_enrollment_params.yaml

brief: The 'wazuh-agentd' program is the client-side daemon that communicates with
  the server. The objective is to check if the enrollment of the agent using certain
  settings in the configuration file produces the expected responses from the server.
components:
- agent
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-agentd
- wazuh-authd
- wazuh-remoted
group_id: 0
id: 2
modules:
- agentd
name: test_agentd_enrollment_params.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2016
- Windows server 2012
- Windows server 2003
references:
- https://documentation.wazuh.com/current/user-manual/registering/index.html
tags:
- enrollment
tests:
- assertions:
  - Verify that expected enrollment request message occurs.
  description: Check different situations that can occur on the 'wazuh-agentd' daemon
    during agent enrollment. The tests are based on using specific configurations
    for the agent, initiate the agent enrollment with the manager, and finally, verify
    that the response received matches the expected one.
  expected_output:
  - Multiple messages corresponding to each test case, located in the external input
    data file.
  input_description: An external YAML file (wazuh_conf.yaml) includes configuration
    settings for the agent. Different test cases are contained in an external YAML
    file (wazuh_enrollment_tests.yaml) which includes enrollment parameters.
  inputs:
  - -No agent name in auto enrollment configuration
  - -Check a valid agent_address configurations
  - -Check a valid agent_address configurations CIDR
  - -Check a invalid CIDR agent_address in auto enrollment configuration
  - -Check a invalid agent_address in auto enrollment configuration
  - -Check a valid manager_address configurations
  - -Agent groups in auto enrollment configuration
  - -Agent multi groups in auto enrollment configuration
  - -Check a invalid enabled in auto enrollment configuration
  - -Check a valid agent_name configurations
  - -Check a valid agent_name configurations max length
  - -Check a invalid agent_name configurations
  - -Check a invalid agent_name configurations too short
  - -Check a invalid agent_name configurations too long
  - -Try auto negotiation option using TLSv1_1
  - -Try auto negotiation option using TLSv1_2
  - -Try TLSv1_1 without auto_negotiation
  - -Try connecting with Compatible ciphers
  - -Try connecting with Incompatible ciphers
  - -Try validating server with a valid certificate
  - -Try validating server with an invalid certificate
  - -Try validating agent with an invalid certificate0
  - -Try validating agent with an invalid certificate1
  - -Check that source IP is sent by agent
  - -Use source IP option while trying to set an IP
  - -Check that configured password is sent on string
  - -Check that password file is open and read successfully0
  - -Check that password file is open and read successfully1
  - -Check a valid port configurations
  - -Check a invalid port configurations 65536
  - -Check a invalid port configurations 0
  - -Check a invalid port configurations -1515
  - -Check a valid delay_after_enrollment configurations 10
  - -Check a invalid delay_after_enrollment configurations -30
  - -Check enrollment with all parameters configurations
  name: test_agent_agentd_enrollment
  parameters:
  - configure_authd_server:
      brief: Initializes a simulated 'wazuh-authd' connection.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - test_case:
      brief: List of tests to be performed.
      type: list
  tags:
  - simulator
  - ssl
  - keys
  wazuh_min_version: 4.2
tier: 0
type: integration

 

test_agentd_multi_server.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "A Wazuh cluster is a group of Wazuh managers that work together to enhance the availability and scalability of the service. These tests will check the agent enrollment in a multi-server environment and how the agent manages the connections to the servers depending on their status.",
    "tier": 0,
    "modules": [
        "agentd"
    ],
    "components": [
        "agent"
    ],
    "daemons": [
        "wazuh-agentd",
        "wazuh-authd",
        "wazuh-remoted"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2016",
        "Windows server 2012",
        "Windows server 2003"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/registering/index.html"
    ],
    "tags": [
        "enrollment"
    ],
    "name": "test_agentd_multi_server.py",
    "id": 3,
    "group_id": 0,
    "tests": [
        {
            "description": "Check the agent's enrollment and connection to a manager in a multi-server environment. Initialize an environment with multiple simulated servers in which the agent is forced to enroll under different test conditions, verifying the agent's behavior through its log files.",
            "wazuh_min_version": 4.2,
            "parameters": [
                {
                    "add_hostnames": {
                        "type": "fixture",
                        "brief": "Adds to the 'hosts' file the names and the IP addresses of the testing servers."
                    }
                },
                {
                    "configure_authd_server": {
                        "type": "fixture",
                        "brief": "Initializes a simulated 'wazuh-authd' connection."
                    }
                },
                {
                    "set_authd_id": {
                        "type": "fixture",
                        "brief": "Sets the agent id to '101' in the 'wazuh-authd' simulated connection."
                    }
                },
                {
                    "clean_keys": {
                        "type": "fixture",
                        "brief": "Clears the 'client.keys' file used by the simulated remote connections."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                }
            ],
            "assertions": [
                "Agent without keys. Verify that all servers will refuse the connection to the 'wazuh-remoted' daemon but will accept enrollment. The agent should try to connect and enroll each of them.",
                "Agent without keys. Verify that the first server only has enrollment available, and the third server only has the 'wazuh-remoted' daemon available. The agent should enroll in the first server and connect to the third one.",
                "Agent without keys. Verify that the agent should enroll and connect to the first server, and then the first server will disconnect. The agent should connect to the second server with the same key.",
                "Agent without keys. Verify that the agent should enroll and connect to the first server, and then the first server will disconnect. The agent should try to enroll in the first server again, and then after failure, move to the second server and connect.",
                "Agent with keys. Verify that the agent should enroll and connect to the last server.",
                "Agent with keys. Verify that the first server is available, but it disconnects, and the second and third servers are not responding. The agent on disconnection should try the second and third servers and go back finally to the first server."
            ],
            "input_description": "An external YAML file (wazuh_conf.yaml) includes configuration settings for the agent. Different test cases are found in the test module and include parameters for the environment setup, the requests to be made, and the expected result.",
            "expected_output": [
                "r'Requesting a key from server'",
                "r'Valid key received'",
                "r'Trying to connect to server'",
                "r'Connected to the server'",
                "r'Received message'",
                "r'Server responded. Releasing lock.'",
                "r'Unable to connect to'"
            ],
            "tags": [
                "simulator",
                "ssl",
                "keys"
            ],
            "name": "test_agentd_multi_server",
            "inputs": [
                "refuse_remoted_accept_enrollment",
                "only_enrollment_and_only_remoted",
                "server_down_fallback_tcp",
                "server_down_fallback_udp",
                "only_one_server_available",
                "unique_available_server_disconnects"
            ]
        }
    ]
}

test_agentd_multi_server.yaml

brief: A Wazuh cluster is a group of Wazuh managers that work together to enhance
  the availability and scalability of the service. These tests will check the agent
  enrollment in a multi-server environment and how the agent manages the connections
  to the servers depending on their status.
components:
- agent
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-agentd
- wazuh-authd
- wazuh-remoted
group_id: 0
id: 3
modules:
- agentd
name: test_agentd_multi_server.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2016
- Windows server 2012
- Windows server 2003
references:
- https://documentation.wazuh.com/current/user-manual/registering/index.html
tags:
- enrollment
tests:
- assertions:
  - Agent without keys. Verify that all servers will refuse the connection to the
    'wazuh-remoted' daemon but will accept enrollment. The agent should try to connect
    and enroll each of them.
  - Agent without keys. Verify that the first server only has enrollment available,
    and the third server only has the 'wazuh-remoted' daemon available. The agent
    should enroll in the first server and connect to the third one.
  - Agent without keys. Verify that the agent should enroll and connect to the first
    server, and then the first server will disconnect. The agent should connect to
    the second server with the same key.
  - Agent without keys. Verify that the agent should enroll and connect to the first
    server, and then the first server will disconnect. The agent should try to enroll
    in the first server again, and then after failure, move to the second server and
    connect.
  - Agent with keys. Verify that the agent should enroll and connect to the last server.
  - Agent with keys. Verify that the first server is available, but it disconnects,
    and the second and third servers are not responding. The agent on disconnection
    should try the second and third servers and go back finally to the first server.
  description: Check the agent's enrollment and connection to a manager in a multi-server
    environment. Initialize an environment with multiple simulated servers in which
    the agent is forced to enroll under different test conditions, verifying the agent's
    behavior through its log files.
  expected_output:
  - r'Requesting a key from server'
  - r'Valid key received'
  - r'Trying to connect to server'
  - r'Connected to the server'
  - r'Received message'
  - r'Server responded. Releasing lock.'
  - r'Unable to connect to'
  input_description: An external YAML file (wazuh_conf.yaml) includes configuration
    settings for the agent. Different test cases are found in the test module and
    include parameters for the environment setup, the requests to be made, and the
    expected result.
  inputs:
  - refuse_remoted_accept_enrollment
  - only_enrollment_and_only_remoted
  - server_down_fallback_tcp
  - server_down_fallback_udp
  - only_one_server_available
  - unique_available_server_disconnects
  name: test_agentd_multi_server
  parameters:
  - add_hostnames:
      brief: Adds to the 'hosts' file the names and the IP addresses of the testing
        servers.
      type: fixture
  - configure_authd_server:
      brief: Initializes a simulated 'wazuh-authd' connection.
      type: fixture
  - set_authd_id:
      brief: Sets the agent id to '101' in the 'wazuh-authd' simulated connection.
      type: fixture
  - clean_keys:
      brief: Clears the 'client.keys' file used by the simulated remote connections.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  tags:
  - simulator
  - ssl
  - keys
  wazuh_min_version: 4.2
tier: 0
type: integration

 

test_agentd_parametrized_reconnections.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-agentd' program is the client-side daemon that communicates with the server. The objective is to check how the 'wazuh-agentd' daemon behaves when there are delays between connection attempts to the 'wazuh-remoted' daemon using TCP and UDP protocols. The 'wazuh-remoted' program is the server side daemon that communicates with the agents.",
    "tier": 0,
    "modules": [
        "agentd"
    ],
    "components": [
        "agent"
    ],
    "daemons": [
        "wazuh-agentd",
        "wazuh-authd",
        "wazuh-remoted"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2016",
        "Windows server 2012",
        "Windows server 2003"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/registering/index.html"
    ],
    "tags": [
        "enrollment"
    ],
    "name": "test_agentd_parametrized_reconnections.py",
    "id": 4,
    "group_id": 0,
    "tests": [
        {
            "description": "Check how the agent behaves when there are delays between connection attempts to the server. For this purpose, different values for 'max_retries' and 'retry_interval' parameters are tested.",
            "wazuh_min_version": 4.2,
            "parameters": [
                {
                    "configure_authd_server": {
                        "type": "fixture",
                        "brief": "Initializes a simulated 'wazuh-authd' connection."
                    }
                },
                {
                    "start_authd": {
                        "type": "fixture",
                        "brief": "Enable the 'wazuh-authd' daemon to accept connections and perform enrollments."
                    }
                },
                {
                    "stop_agent": {
                        "type": "fixture",
                        "brief": "Stop Wazuh's agent."
                    }
                },
                {
                    "set_keys": {
                        "type": "fixture",
                        "brief": "Write to 'client.keys' file the agent's enrollment details."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                }
            ],
            "assertions": [
                "Verify that when the 'wazuh-agentd' daemon initializes, it connects to the 'wazuh-remoted' daemon of the manager before reaching the maximum number of attempts.",
                "Verify the successful enrollment of the agent if the auto-enrollment option is enabled.",
                "Verify that the rollback feature of the server works correctly."
            ],
            "input_description": "An external YAML file (wazuh_conf.yaml) includes configuration settings for the agent. Different test cases are found in the test module and include parameters for the environment setup using the TCP and UDP protocols.",
            "expected_output": [
                "r'Valid key received'",
                "r'Trying to connect to server'",
                "r'Unable to connect to any server'"
            ],
            "tags": [
                "simulator",
                "ssl",
                "keys"
            ],
            "name": "test_agentd_parametrized_reconnections",
            "inputs": [
                "udp_max-retry=1_interval=1_enroll=no",
                "udp_max-retry=5_interval=5_enroll=no",
                "udp_max-retry=10_interval=4_enroll=no",
                "udp_max-retry=3_interval=12_enroll=no",
                "tcp_max-retry=3_interval=3_enroll=no",
                "tcp_max-retry=5_interval=5_enroll=no",
                "tcp_max-retry=10_interval=10_enroll=no",
                "udp_max-retry=2_interval=2_enroll=yes",
                "tcp_max-retry=5_interval=5_enroll=yes"
            ]
        }
    ]
}

test_agentd_parametrized_reconnections.yaml

brief: The 'wazuh-agentd' program is the client-side daemon that communicates with
  the server. The objective is to check how the 'wazuh-agentd' daemon behaves when
  there are delays between connection attempts to the 'wazuh-remoted' daemon using
  TCP and UDP protocols. The 'wazuh-remoted' program is the server side daemon that
  communicates with the agents.
components:
- agent
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-agentd
- wazuh-authd
- wazuh-remoted
group_id: 0
id: 4
modules:
- agentd
name: test_agentd_parametrized_reconnections.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2016
- Windows server 2012
- Windows server 2003
references:
- https://documentation.wazuh.com/current/user-manual/registering/index.html
tags:
- enrollment
tests:
- assertions:
  - Verify that when the 'wazuh-agentd' daemon initializes, it connects to the 'wazuh-remoted'
    daemon of the manager before reaching the maximum number of attempts.
  - Verify the successful enrollment of the agent if the auto-enrollment option is
    enabled.
  - Verify that the rollback feature of the server works correctly.
  description: Check how the agent behaves when there are delays between connection
    attempts to the server. For this purpose, different values for 'max_retries' and
    'retry_interval' parameters are tested.
  expected_output:
  - r'Valid key received'
  - r'Trying to connect to server'
  - r'Unable to connect to any server'
  input_description: An external YAML file (wazuh_conf.yaml) includes configuration
    settings for the agent. Different test cases are found in the test module and
    include parameters for the environment setup using the TCP and UDP protocols.
  inputs:
  - udp_max-retry=1_interval=1_enroll=no
  - udp_max-retry=5_interval=5_enroll=no
  - udp_max-retry=10_interval=4_enroll=no
  - udp_max-retry=3_interval=12_enroll=no
  - tcp_max-retry=3_interval=3_enroll=no
  - tcp_max-retry=5_interval=5_enroll=no
  - tcp_max-retry=10_interval=10_enroll=no
  - udp_max-retry=2_interval=2_enroll=yes
  - tcp_max-retry=5_interval=5_enroll=yes
  name: test_agentd_parametrized_reconnections
  parameters:
  - configure_authd_server:
      brief: Initializes a simulated 'wazuh-authd' connection.
      type: fixture
  - start_authd:
      brief: Enable the 'wazuh-authd' daemon to accept connections and perform enrollments.
      type: fixture
  - stop_agent:
      brief: Stop Wazuh's agent.
      type: fixture
  - set_keys:
      brief: Write to 'client.keys' file the agent's enrollment details.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  tags:
  - simulator
  - ssl
  - keys
  wazuh_min_version: 4.2
tier: 0
type: integration

 

test_agentd_reconnection.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-agentd' program is the client-side daemon that communicates with the server. The objective is to check that, with different states in the 'clients.keys' file, the agent successfully enrolls after losing connection with the 'wazuh-remoted' daemon. The wazuh-remoted program is the server side daemon that communicates with the agents.",
    "tier": 0,
    "modules": [
        "agentd"
    ],
    "components": [
        "agent"
    ],
    "daemons": [
        "wazuh-agentd",
        "wazuh-authd",
        "wazuh-remoted"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2016",
        "Windows server 2012",
        "Windows server 2003"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/registering/index.html"
    ],
    "tags": [
        "enrollment"
    ],
    "name": "test_agentd_reconnection.py",
    "id": 5,
    "group_id": 0,
    "tests": [
        {
            "description": "Check how the agent behaves when losing communication with the 'wazuh-remoted' daemon and a new enrollment is sent to the 'wazuh-authd' daemon. In this case, the agent starts with keys.",
            "wazuh_min_version": 4.2,
            "parameters": [
                {
                    "configure_authd_server": {
                        "type": "fixture",
                        "brief": "Initializes a simulated wazuh-authd connection."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                }
            ],
            "assertions": [
                "Verify that the agent enrollment is successful."
            ],
            "input_description": "An external YAML file (wazuh_conf.yaml) includes configuration settings for the agent. Two test cases are found in the test module and include parameters for the environment setup using the TCP and UDP protocols.",
            "expected_output": [
                "r'Valid key received'",
                "r'Sending keep alive'"
            ],
            "tags": [
                "simulator",
                "ssl",
                "keys"
            ],
            "name": "test_agentd_reconection_enrollment_with_keys",
            "inputs": [
                "tcp",
                "udp"
            ]
        },
        {
            "description": "Check how the agent behaves when losing communication with the 'wazuh-remoted' daemon and a new enrollment is sent to the 'wazuh-authd' daemon. In this case, the agent doesn't have the 'client.keys' file.",
            "wazuh_min_version": 4.2,
            "parameters": [
                {
                    "configure_authd_server": {
                        "type": "fixture",
                        "brief": "Initializes a simulated 'wazuh-authd' connection."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                }
            ],
            "assertions": [
                "Verify that the agent enrollment is successful."
            ],
            "input_description": "An external YAML file (wazuh_conf.yaml) includes configuration settings for the agent. Two test cases are found in the test module and include parameters for the environment setup using the TCP and UDP protocols.",
            "expected_output": [
                "r'Valid key received'",
                "r'Sending keep alive'"
            ],
            "tags": [
                "simulator",
                "ssl",
                "keys"
            ],
            "name": "test_agentd_reconection_enrollment_no_keys_file",
            "inputs": [
                "tcp",
                "udp"
            ]
        },
        {
            "description": "Check how the agent behaves when losing communication with the 'wazuh-remoted' daemon and a new enrollment is sent to the 'wazuh-authd' daemon. In this case, the agent has its 'client.keys' file empty.",
            "wazuh_min_version": 4.2,
            "parameters": [
                {
                    "configure_authd_server": {
                        "type": "fixture",
                        "brief": "Initializes a simulated 'wazuh-authd' connection."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                }
            ],
            "assertions": [
                "Verify that the agent enrollment is successful."
            ],
            "input_description": "An external YAML file (wazuh_conf.yaml) includes configuration settings for the agent. Two test cases are found in the test module and include parameters for the environment setup using the TCP and UDP protocols.",
            "expected_output": [
                "r'Valid key received'",
                "r'Sending keep alive'"
            ],
            "tags": [
                "simulator",
                "ssl",
                "keys"
            ],
            "name": "test_agentd_reconection_enrollment_no_keys",
            "inputs": [
                "tcp",
                "udp"
            ]
        },
        {
            "description": "Check how the agent behaves when it makes multiple enrollment attempts before getting its key. For this, the agent starts without keys and performs multiple enrollment requests to the 'wazuh-authd' daemon before getting the new key to communicate with the 'wazuh-remoted' daemon.",
            "wazuh_min_version": 4.2,
            "parameters": [
                {
                    "configure_authd_server": {
                        "type": "fixture",
                        "brief": "Initializes a simulated 'wazuh-authd' connection."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                }
            ],
            "assertions": [
                "Verify that the agent enrollment is successful."
            ],
            "input_description": "An external YAML file (wazuh_conf.yaml) includes configuration settings for the agent. Two test cases are found in the test module and include parameters for the environment setup using the 'TCP' and 'UDP' protocols.",
            "expected_output": [
                "r'Requesting a key'",
                "r'Valid key received'",
                "r'Sending keep alive'"
            ],
            "tags": [
                "simulator",
                "ssl",
                "keys"
            ],
            "name": "test_agentd_initial_enrollment_retries",
            "inputs": [
                "tcp",
                "udp"
            ]
        },
        {
            "description": "Check how the agent behaves when the 'wazuh-remoted' daemon is not available and performs multiple connection attempts to it. For this, the agent starts with keys but the 'wazuh-remoted' daemon is not available for several seconds, then the agent performs multiple connection retries before requesting a new enrollment.",
            "wazuh_min_version": 4.2,
            "parameters": [
                {
                    "configure_authd_server": {
                        "type": "fixture",
                        "brief": "Initializes a simulated 'wazuh-authd' connection."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                }
            ],
            "assertions": [
                "Verify that the agent enrollment is successful."
            ],
            "input_description": "An external YAML file (wazuh_conf.yaml) includes configuration settings for the agent. Two test cases are found in the test module and include parameters for the environment setup using the TCP and UDP protocols.",
            "expected_output": [
                "r'Sending keep alive'"
            ],
            "tags": [
                "simulator",
                "ssl",
                "keys"
            ],
            "name": "test_agentd_connection_retries_pre_enrollment",
            "inputs": [
                "tcp",
                "udp"
            ]
        }
    ]
}

test_agentd_reconnection.yaml

brief: The 'wazuh-agentd' program is the client-side daemon that communicates with
  the server. The objective is to check that, with different states in the 'clients.keys'
  file, the agent successfully enrolls after losing connection with the 'wazuh-remoted'
  daemon. The wazuh-remoted program is the server side daemon that communicates with
  the agents.
components:
- agent
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-agentd
- wazuh-authd
- wazuh-remoted
group_id: 0
id: 5
modules:
- agentd
name: test_agentd_reconnection.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2016
- Windows server 2012
- Windows server 2003
references:
- https://documentation.wazuh.com/current/user-manual/registering/index.html
tags:
- enrollment
tests:
- assertions:
  - Verify that the agent enrollment is successful.
  description: Check how the agent behaves when losing communication with the 'wazuh-remoted'
    daemon and a new enrollment is sent to the 'wazuh-authd' daemon. In this case,
    the agent starts with keys.
  expected_output:
  - r'Valid key received'
  - r'Sending keep alive'
  input_description: An external YAML file (wazuh_conf.yaml) includes configuration
    settings for the agent. Two test cases are found in the test module and include
    parameters for the environment setup using the TCP and UDP protocols.
  inputs:
  - tcp
  - udp
  name: test_agentd_reconection_enrollment_with_keys
  parameters:
  - configure_authd_server:
      brief: Initializes a simulated wazuh-authd connection.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  tags:
  - simulator
  - ssl
  - keys
  wazuh_min_version: 4.2
- assertions:
  - Verify that the agent enrollment is successful.
  description: Check how the agent behaves when losing communication with the 'wazuh-remoted'
    daemon and a new enrollment is sent to the 'wazuh-authd' daemon. In this case,
    the agent doesn't have the 'client.keys' file.
  expected_output:
  - r'Valid key received'
  - r'Sending keep alive'
  input_description: An external YAML file (wazuh_conf.yaml) includes configuration
    settings for the agent. Two test cases are found in the test module and include
    parameters for the environment setup using the TCP and UDP protocols.
  inputs:
  - tcp
  - udp
  name: test_agentd_reconection_enrollment_no_keys_file
  parameters:
  - configure_authd_server:
      brief: Initializes a simulated 'wazuh-authd' connection.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  tags:
  - simulator
  - ssl
  - keys
  wazuh_min_version: 4.2
- assertions:
  - Verify that the agent enrollment is successful.
  description: Check how the agent behaves when losing communication with the 'wazuh-remoted'
    daemon and a new enrollment is sent to the 'wazuh-authd' daemon. In this case,
    the agent has its 'client.keys' file empty.
  expected_output:
  - r'Valid key received'
  - r'Sending keep alive'
  input_description: An external YAML file (wazuh_conf.yaml) includes configuration
    settings for the agent. Two test cases are found in the test module and include
    parameters for the environment setup using the TCP and UDP protocols.
  inputs:
  - tcp
  - udp
  name: test_agentd_reconection_enrollment_no_keys
  parameters:
  - configure_authd_server:
      brief: Initializes a simulated 'wazuh-authd' connection.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  tags:
  - simulator
  - ssl
  - keys
  wazuh_min_version: 4.2
- assertions:
  - Verify that the agent enrollment is successful.
  description: Check how the agent behaves when it makes multiple enrollment attempts
    before getting its key. For this, the agent starts without keys and performs multiple
    enrollment requests to the 'wazuh-authd' daemon before getting the new key to
    communicate with the 'wazuh-remoted' daemon.
  expected_output:
  - r'Requesting a key'
  - r'Valid key received'
  - r'Sending keep alive'
  input_description: An external YAML file (wazuh_conf.yaml) includes configuration
    settings for the agent. Two test cases are found in the test module and include
    parameters for the environment setup using the 'TCP' and 'UDP' protocols.
  inputs:
  - tcp
  - udp
  name: test_agentd_initial_enrollment_retries
  parameters:
  - configure_authd_server:
      brief: Initializes a simulated 'wazuh-authd' connection.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  tags:
  - simulator
  - ssl
  - keys
  wazuh_min_version: 4.2
- assertions:
  - Verify that the agent enrollment is successful.
  description: Check how the agent behaves when the 'wazuh-remoted' daemon is not
    available and performs multiple connection attempts to it. For this, the agent
    starts with keys but the 'wazuh-remoted' daemon is not available for several seconds,
    then the agent performs multiple connection retries before requesting a new enrollment.
  expected_output:
  - r'Sending keep alive'
  input_description: An external YAML file (wazuh_conf.yaml) includes configuration
    settings for the agent. Two test cases are found in the test module and include
    parameters for the environment setup using the TCP and UDP protocols.
  inputs:
  - tcp
  - udp
  name: test_agentd_connection_retries_pre_enrollment
  parameters:
  - configure_authd_server:
      brief: Initializes a simulated 'wazuh-authd' connection.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  tags:
  - simulator
  - ssl
  - keys
  wazuh_min_version: 4.2
tier: 0
type: integration

 

test_agentd_state_config.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-agentd' program is the client-side daemon that communicates with the server. These tests will check if the configuration options related to the statistics file of the 'wazuh-agentd' daemon are working properly. The statistics files are documents that show real-time information about the Wazuh environment.",
    "tier": 0,
    "modules": [
        "agentd"
    ],
    "components": [
        "agent"
    ],
    "daemons": [
        "wazuh-agentd"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2016",
        "Windows server 2012",
        "Windows server 2003"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/reference/statistics-files/wazuh-agentd-state.html"
    ],
    "tags": [
        "stats_file"
    ],
    "name": "test_agentd_state_config.py",
    "id": 7,
    "group_id": 0,
    "tests": [
        {
            "description": "Check that the 'wazuh-agentd.state' statistics file is created automatically and verify that it is updated at the set intervals.",
            "wazuh_min_version": 4.2,
            "parameters": [
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "test_case": {
                        "type": "list",
                        "brief": "List of tests to be performed."
                    }
                }
            ],
            "assertions": [
                "Verify that the 'wazuh-agentd.state' statistics file has been created.",
                "Verify that the 'wazuh-agentd.state' statistics file is updated at the specified intervals."
            ],
            "input_description": "An external YAML file (wazuh_conf.yaml) includes configuration settings for the agent. Different test cases that are contained in an external YAML file (wazuh_state_config_tests.yaml) that includes the parameters and their expected responses.",
            "expected_output": [
                "r'interval_not_found'",
                "r'interval_not_valid'",
                "r'file_enabled'",
                "r'file_not_enabled'"
            ],
            "name": "test_agentd_state_config",
            "inputs": [
                "get_configuration0-Negative state interval",
                "get_configuration0-Undefined state interval value",
                "get_configuration0-State interval option dont exist",
                "get_configuration0-Zero state interval",
                "get_configuration0-Too big state interval",
                "get_configuration0-Default state interval"
            ]
        }
    ]
}

test_agentd_state_config.yaml

brief: The 'wazuh-agentd' program is the client-side daemon that communicates with
  the server. These tests will check if the configuration options related to the statistics
  file of the 'wazuh-agentd' daemon are working properly. The statistics files are
  documents that show real-time information about the Wazuh environment.
components:
- agent
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-agentd
group_id: 0
id: 7
modules:
- agentd
name: test_agentd_state_config.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2016
- Windows server 2012
- Windows server 2003
references:
- https://documentation.wazuh.com/current/user-manual/reference/statistics-files/wazuh-agentd-state.html
tags:
- stats_file
tests:
- assertions:
  - Verify that the 'wazuh-agentd.state' statistics file has been created.
  - Verify that the 'wazuh-agentd.state' statistics file is updated at the specified
    intervals.
  description: Check that the 'wazuh-agentd.state' statistics file is created automatically
    and verify that it is updated at the set intervals.
  expected_output:
  - r'interval_not_found'
  - r'interval_not_valid'
  - r'file_enabled'
  - r'file_not_enabled'
  input_description: An external YAML file (wazuh_conf.yaml) includes configuration
    settings for the agent. Different test cases that are contained in an external
    YAML file (wazuh_state_config_tests.yaml) that includes the parameters and their
    expected responses.
  inputs:
  - get_configuration0-Negative state interval
  - get_configuration0-Undefined state interval value
  - get_configuration0-State interval option dont exist
  - get_configuration0-Zero state interval
  - get_configuration0-Too big state interval
  - get_configuration0-Default state interval
  name: test_agentd_state_config
  parameters:
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - test_case:
      brief: List of tests to be performed.
      type: list
  wazuh_min_version: 4.2
tier: 0
type: integration

 

test_agentd_state.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-agentd' program is the client-side daemon that communicates with the server. These tests will check if the content of the 'wazuh-agentd' daemon statistics file is valid. The statistics files are documents that show real-time information about the Wazuh environment.",
    "tier": 0,
    "modules": [
        "agentd"
    ],
    "components": [
        "agent"
    ],
    "daemons": [
        "wazuh-agentd",
        "wazuh-remoted"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2016",
        "Windows server 2012",
        "Windows server 2003"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/reference/statistics-files/wazuh-agentd-state.html"
    ],
    "tags": [
        "stats_file"
    ],
    "name": "test_agentd_state.py",
    "id": 6,
    "group_id": 0,
    "tests": [
        {
            "description": "Check that the statistics file 'wazuh-agentd.state' is created automatically and verify that the content of its fields is correct.",
            "wazuh_min_version": 4.2,
            "parameters": [
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "test_case": {
                        "type": "list",
                        "brief": "List of tests to be performed."
                    }
                }
            ],
            "assertions": [
                "Verify that the 'wazuh-agentd.state' statistics file has been created.",
                "Verify that the information stored in the 'wazuh-agentd.state' statistics file is consistent with the connection status to the 'wazuh-remoted' daemon."
            ],
            "input_description": "An external YAML file (wazuh_conf.yaml) includes configuration settings for the agent. Different test cases that are contained in an external YAML file (wazuh_state_tests.yaml) that includes the parameters and their expected responses.",
            "expected_output": [
                "r'pending'",
                "r'connected'"
            ],
            "name": "test_agentd_state",
            "inputs": [
                "-No connection with remoted",
                "-Successful connection with remoted",
                "-Only remote request available"
            ]
        }
    ]
}

test_agentd_state.yaml

brief: The 'wazuh-agentd' program is the client-side daemon that communicates with
  the server. These tests will check if the content of the 'wazuh-agentd' daemon statistics
  file is valid. The statistics files are documents that show real-time information
  about the Wazuh environment.
components:
- agent
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-agentd
- wazuh-remoted
group_id: 0
id: 6
modules:
- agentd
name: test_agentd_state.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2016
- Windows server 2012
- Windows server 2003
references:
- https://documentation.wazuh.com/current/user-manual/reference/statistics-files/wazuh-agentd-state.html
tags:
- stats_file
tests:
- assertions:
  - Verify that the 'wazuh-agentd.state' statistics file has been created.
  - Verify that the information stored in the 'wazuh-agentd.state' statistics file
    is consistent with the connection status to the 'wazuh-remoted' daemon.
  description: Check that the statistics file 'wazuh-agentd.state' is created automatically
    and verify that the content of its fields is correct.
  expected_output:
  - r'pending'
  - r'connected'
  input_description: An external YAML file (wazuh_conf.yaml) includes configuration
    settings for the agent. Different test cases that are contained in an external
    YAML file (wazuh_state_tests.yaml) that includes the parameters and their expected
    responses.
  inputs:
  - -No connection with remoted
  - -Successful connection with remoted
  - -Only remote request available
  name: test_agentd_state
  parameters:
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - test_case:
      brief: List of tests to be performed.
      type: list
  wazuh_min_version: 4.2
tier: 0
type: integration

Tests

  • Python codebase satisfies PEP-8 style style guide. pycodestyle --max-line-length=120 --show-source --show-pep8 file.py.
  • The DocGenerator sanity check test does not return errors. python3 DocGenerator.py -s

The following tests have been documentated:
  * test_agent_auth_enrollment.py
  * test_agentd_enrollment_params.py
  * test_agentd_multi_server.py
  * test_agentd_parametrized_reconnections.py
  * test_agentd_reconnection.py
  * test_agentd_state.py
  * test_agentd_state_config.py
The current scheme of the issue #1694 has been used.
PEP-8 fixes.

Closes: #1796
@mdengra mdengra requested a review from snaow October 8, 2021 10:57
@mdengra mdengra self-assigned this Oct 8, 2021
@snaow snaow merged commit 8ae8dd0 into master Nov 2, 2021
@snaow snaow deleted the 1796-migrate-doc-agentd branch November 2, 2021 19:37
@snaow snaow mentioned this pull request Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants